package interface_;

//要先extends(继承),后implements(实现)
public class Dog extends Animal implements ISwimming,IRunning{
    public int age;

    //重写接口中的抽象方法
    @Override
    public void swimming() {
        System.out.println(super.name + this.age + "swimming");
    }
    @Override
    public void running() {
        System.out.println(super.name + this.age + "running");
    }

    public Dog(String name,int age){
        super(name); //调用父类构造完成初始化初始化
        this.age=age;
    }

    //重写从父类继承的bark()方法，以发生多态
    @Override
    public void bark() {
        System.out.println(this.name + "汪汪叫");
    }
}
